
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Java IO -- IO流的概念和分类 · 寒江蓑笠的博客</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="介绍IO流的概念和分类">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="java-basic-final.html" />
    
    
    <link rel="prev" href="java-basic-reflect.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="java-basic-joor.html">
            
                <a href="java-basic-joor.html">
            
                    
                    Java 基础 -- 使用 JOOR 实现反射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="java-basic-annotation.html">
            
                <a href="java-basic-annotation.html">
            
                    
                    Java基础 -- 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3" data-path="java-basic-threadlocal.html">
            
                <a href="java-basic-threadlocal.html">
            
                    
                    Java 基础 -- ThreadLocal
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.4" data-path="java-development-skills-get-stacktrace.html">
            
                <a href="java-development-skills-get-stacktrace.html">
            
                    
                    Java 开发技巧 -- 获取 Java 的调用栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.5" data-path="java-basic-concurrent-map-collection.html">
            
                <a href="java-basic-concurrent-map-collection.html">
            
                    
                    Java 基础 -- 并发集合的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.6" data-path="java-dynamic-proxy-invocationhandler-demo.html">
            
                <a href="java-dynamic-proxy-invocationhandler-demo.html">
            
                    
                    Java InvocationHandler 实现动态代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.7" data-path="java-basic-try-catch-finally.html">
            
                <a href="java-basic-try-catch-finally.html">
            
                    
                    Java 基础 -- 深入理解 try catch finally
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.8" data-path="java-basic-reflect.html">
            
                <a href="java-basic-reflect.html">
            
                    
                    Java 基础 -- 反射
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.1.9" data-path="java-basic-io-stream.html">
            
                <a href="java-basic-io-stream.html">
            
                    
                    Java IO -- IO流的概念和分类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.10" data-path="java-basic-final.html">
            
                <a href="java-basic-final.html">
            
                    
                    Java 基础 -- 深入理解 final 修饰符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.11" data-path="java-basic-memory-manage-constructor.html">
            
                <a href="java-basic-memory-manage-constructor.html">
            
                    
                    Java 内存管理 -- 父子实例的内存控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.12" data-path="java-basic-memory-manage-inherit-object.html">
            
                <a href="java-basic-memory-manage-inherit-object.html">
            
                    
                    Java 内存管理 -- 构造方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.13" data-path="java-basic-memory-manage-memory-area.html">
            
                <a href="java-basic-memory-manage-memory-area.html">
            
                    
                    Java 内存管理 -- 内存区域的划分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.14" data-path="java-basic-memory-manage-variable.html">
            
                <a href="java-basic-memory-manage-variable.html">
            
                    
                    Java 内存管理 -- 变量的内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.15" data-path="java-basic-knowledge-generic.html">
            
                <a href="java-basic-knowledge-generic.html">
            
                    
                    Java 基础 -- 范型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.16" data-path="java-basic-knowledge-auto-boxing.html">
            
                <a href="java-basic-knowledge-auto-boxing.html">
            
                    
                    Java 基础 -- 关于自动装箱和拆箱机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.17" data-path="java-basic-knowledge-parameter-passing.html">
            
                <a href="java-basic-knowledge-parameter-passing.html">
            
                    
                    Java 基础 -- 值传递、引用传递和参数传递
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.18" data-path="java-basic-stringbuilder-stringbuffer.html">
            
                <a href="java-basic-stringbuilder-stringbuffer.html">
            
                    
                    Java 基础 -- StringBuilder 和 StringBuffer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.19" data-path="java-basic-knowledge-about-string.html">
            
                <a href="java-basic-knowledge-about-string.html">
            
                    
                    Java 基础 -- 深入理解 String
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.20" data-path="java-basic-linkedhashmap.html">
            
                <a href="java-basic-linkedhashmap.html">
            
                    
                    Java 基础 -- LinkedHashMap 的使用和原理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >Java IO -- IO流的概念和分类</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x6982;&#x8FF0;">&#x6982;&#x8FF0;</h2>
<p>Java &#x7684;I/O&#x6D41;&#x662F;&#x5B9E;&#x73B0;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x7684;&#x57FA;&#x7840;&#xFF0C;&#x5B83;&#x53EF;&#x4EE5;&#x65B9;&#x4FBF;&#x5730;&#x5B9E;&#x73B0;&#x6570;&#x636E;&#x7684;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x64CD;&#x4F5C;&#xFF0C;&#x5728; Java &#x4E2D;&#x628A;&#x4E0D;&#x540C;&#x7684;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x6E90;&#xFF08;&#x952E;&#x76D8;&#x3001;&#x6587;&#x4EF6;&#x3001;&#x7F51;&#x7EDC;&#x7B49;&#xFF09;&#x62BD;&#x8C61;&#x8868;&#x793A;&#x4E3A;&#x6D41;&#x3002;&#x8FD9;&#x6837;&#x505A;&#x7B80;&#x5316;&#x4E86;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x5904;&#x7406;&#x3002;
Java &#x7684;IO&#x6D41;&#x6D89;&#x53CA;&#x5230;&#x4E86;40&#x591A;&#x4E2A;&#x7C7B;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<p><img src="../../images/java-io-stream-base/io-class.png" alt="&#x6548;&#x679C;&#x56FE;"></p>
<h2 id="io&#x6D41;&#x7684;&#x5206;&#x7C7B;">I/O&#x6D41;&#x7684;&#x5206;&#x7C7B;</h2>
<h3 id="&#x5B57;&#x7B26;&#x6D41;&#x548C;&#x5B57;&#x8282;&#x6D41;">&#x5B57;&#x7B26;&#x6D41;&#x548C;&#x5B57;&#x8282;&#x6D41;</h3>
<p>I/O &#x6309;&#x7167;&#x5904;&#x7406;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x5206;&#x4E3A;&#xFF1A;&#x5B57;&#x7B26;&#x6D41;&#xFF08;Reader&#x548C;Writer&#x53CA;&#x5176;&#x5B50;&#x7C7B;&#xFF09;&#x548C;&#x5B57;&#x8282;&#x6D41;&#xFF08;InputStream&#x548C;outPutStream&#x53CA;&#x5176;&#x5B50;&#x7C7B;&#xFF09;&#x3002;
&#x5B57;&#x7B26;&#x6D41;&#x548C;&#x5B57;&#x8282;&#x6D41;&#x7684;&#x7528;&#x6CD5;&#x51E0;&#x4E4E;&#x662F;&#x4E00;&#x6837;&#x7684;&#xFF0C;&#x5B83;&#x4EEC;&#x7684;&#x533A;&#x522B;&#x5982;&#x4E0B;&#xFF1A;</p>
<ul>
<li>&#x64CD;&#x4F5C;&#x6570;&#x636E;&#x5355;&#x5143;&#x4E0D;&#x540C;&#xFF1A;&#x5B57;&#x8282;&#x6D41;&#x662F;&#x4EE5;&#x5B57;&#x8282;&#xFF08;8bit&#xFF09;&#x4E3A;&#x5355;&#x4F4D;&#xFF0C;&#x5B57;&#x7B26;&#x6D41;&#x662F;&#x4EE5;&#x5B57;&#x7B26;&#x4E3A;&#x5355;&#x4F4D;&#xFF0C;&#x6839;&#x636E;&#x7801;&#x8868;&#x6620;&#x5C04;&#x5B57;&#x7B26;&#xFF0C;&#x4E00;&#x6B21;&#x53EF;&#x80FD;&#x8BFB;&#x591A;&#x4E2A;&#x5B57;&#x8282;&#x3002;</li>
<li>&#x5904;&#x7406;&#x5BF9;&#x8C61;&#x4E0D;&#x540C;&#xFF1A;&#x5B57;&#x8282;&#x6D41;&#x80FD;&#x5904;&#x7406;&#x6240;&#x6709;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#xFF08;&#x5982;&#x56FE;&#x7247;&#x3001;avi&#x7B49;&#xFF09;&#xFF0C;&#x800C;&#x5B57;&#x7B26;&#x6D41;&#x53EA;&#x80FD;&#x5904;&#x7406;&#x5B57;&#x7B26;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#x3002;</li>
<li>&#x5B57;&#x8282;&#x6D41;&#x5728;&#x64CD;&#x4F5C;&#x7684;&#x65F6;&#x5019;&#x672C;&#x8EAB;&#x662F;&#x4E0D;&#x4F1A;&#x7528;&#x5230;&#x7F13;&#x51B2;&#x533A;&#x7684;&#xFF0C;&#x662F;&#x6587;&#x4EF6;&#x672C;&#x8EAB;&#x7684;&#x76F4;&#x63A5;&#x64CD;&#x4F5C;&#x7684;&#xFF1B;&#x800C;&#x5B57;&#x7B26;&#x6D41;&#x5728;&#x64CD;&#x4F5C;&#x7684;&#x65F6;&#x5019;&#x4E0B;&#x540E;&#x662F;&#x4F1A;&#x7528;&#x5230;&#x7F13;&#x51B2;&#x533A;&#x7684;&#xFF0C;&#x662F;&#x901A;&#x8FC7;&#x7F13;&#x51B2;&#x533A;&#x6765;&#x64CD;&#x4F5C;&#x6587;&#x4EF6;&#x3002;</li>
</ul>
<p>&#x6211;&#x4EEC;&#x5E73;&#x65F6;&#x4F7F;&#x7528;&#x65F6;&#x4F18;&#x5148;&#x9009;&#x62E9;&#x4F7F;&#x7528;&#x5B57;&#x8282;&#x6D41;&#xFF0C;&#x9996;&#x5148;&#x56E0;&#x4E3A;&#x786C;&#x76D8;&#x4E0A;&#x7684;&#x6240;&#x6709;&#x6587;&#x4EF6;&#x90FD;&#x662F;&#x4EE5;&#x5B57;&#x8282;&#x7684;&#x5F62;&#x5F0F;&#x8FDB;&#x884C;&#x4F20;&#x8F93;&#x6216;&#x8005;&#x4FDD;&#x5B58;&#x7684;&#xFF0C;&#x5305;&#x62EC;&#x56FE;&#x7247;&#x7B49;&#x5185;&#x5BB9;&#x3002;&#x4F46;&#x662F;&#x5B57;&#x7B26;&#x53EA;&#x662F;&#x5728;&#x5185;&#x5B58;&#x4E2D;&#x624D;&#x4F1A;&#x5F62;&#x6210;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x5728;&#x5F00;&#x53D1;&#x4E2D;&#xFF0C;&#x5B57;&#x8282;&#x6D41;&#x4F7F;&#x7528;&#x5E7F;&#x6CDB;&#x3002;</p>
<h3 id="&#x8F93;&#x5165;&#x6D41;&#x548C;&#x8F93;&#x51FA;&#x6D41;">&#x8F93;&#x5165;&#x6D41;&#x548C;&#x8F93;&#x51FA;&#x6D41;</h3>
<p>&#x5BF9;&#x8F93;&#x5165;&#x6D41;&#x53EA;&#x80FD;&#x8FDB;&#x884C;&#x8BFB;&#x64CD;&#x4F5C;&#xFF08;InputStream&#x548C;Reader&#x4EE5;&#x53CA;&#x5B83;&#x4EEC;&#x7684;&#x5B50;&#x7C7B;&#xFF09;&#xFF0C;&#x5BF9;&#x8F93;&#x51FA;&#x6D41;&#x53EA;&#x80FD;&#x8FDB;&#x884C;&#x5199;&#x64CD;&#x4F5C;&#xFF08;OutputStream&#x548C;Writer&#x4EE5;&#x53CA;&#x5B83;&#x4EEC;&#x7684;&#x5B50;&#x7C7B;&#xFF09;&#x3002;</p>
<h3 id="&#x8282;&#x70B9;&#x6D41;&#x548C;&#x5904;&#x7406;&#x6D41;">&#x8282;&#x70B9;&#x6D41;&#x548C;&#x5904;&#x7406;&#x6D41;</h3>
<p>&#x6309;&#x7167;&#x6D41;&#x7684;&#x89D2;&#x8272;&#x6765;&#x5206;&#xFF0C;&#x53EF;&#x4EE5;&#x5206;&#x4E3A;&#x8282;&#x70B9;&#x6D41;&#x548C;&#x5904;&#x7406;&#x6D41;&#x3002;&#x5904;&#x7406;&#x6D41;&#x4E5F;&#x53EB;&#x8FC7;&#x6EE4;&#x6D41;&#x548C;&#x5305;&#x88C5;&#x6D41;&#x3002;
&#x4F7F;&#x7528;&#x8282;&#x70B9;&#x6D41;&#x8FDB;&#x884C;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x65F6;&#xFF0C;&#x7A0B;&#x5E8F;&#x76F4;&#x63A5;&#x8FDE;&#x63A5;&#x5230;&#x5B9E;&#x9645;&#x7684;&#x6570;&#x636E;&#x6D41;&#xFF0C;&#x548C;&#x5B9E;&#x9645;&#x7684;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x8282;&#x70B9;&#x8FDE;&#x63A5;&#x3002;&#x8282;&#x70B9;&#x6D41;&#x4E5F;&#x79F0;&#x4E3A;&#x4F4E;&#x7EA7;&#x6D41;&#x3002;
&#x5904;&#x7406;&#x6D41;&#x5219;&#x7528;&#x4E8E;&#x5BF9;&#x4E00;&#x4E2A;&#x5DF2;&#x5B58;&#x5728;&#x7684;&#x6D41;&#x8FDB;&#x884C;&#x8FDE;&#x63A5;&#x6216;&#x5C01;&#x88C5;&#xFF0C;&#x901A;&#x8FC7;&#x5C01;&#x88C5;&#x540E;&#x7684;&#x6D41;&#x6765;&#x5B9E;&#x73B0;&#x6570;&#x636E;&#x8BFB;&#x5199;&#x529F;&#x80FD;&#xFF0C;&#x53EF;&#x4EE5;&#x66F4;&#x52A0;&#x7075;&#x6D3B;&#x65B9;&#x4FBF;&#x5730;&#x8BFB;&#x5199;&#x5404;&#x79CD;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#x3002;&#x5904;&#x7406;&#x6D41;&#x4E5F;&#x88AB;&#x79F0;&#x4E3A;&#x9AD8;&#x7EA7;&#x6D41;&#x3002;
&#x5F53;&#x4F7F;&#x7528;&#x5904;&#x7406;&#x6D41;&#x8FDB;&#x884C;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x65F6;&#xFF0C;&#x7A0B;&#x5E8F;&#x5E76;&#x4E0D;&#x4F1A;&#x76F4;&#x63A5;&#x8FDE;&#x63A5;&#x5230;&#x5B9E;&#x9645;&#x7684;&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x6CA1;&#x6709;&#x548C;&#x5B9E;&#x9645;&#x7684;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x8282;&#x70B9;&#x8FDE;&#x63A5;&#x3002;&#x4F7F;&#x7528;&#x5904;&#x7406;&#x6D41;&#x7684;&#x4E00;&#x4E2A;&#x660E;&#x663E;&#x597D;&#x5904;&#x662F;&#xFF0C;&#x53EA;&#x8981;&#x4F7F;&#x7528;&#x76F8;&#x540C;&#x7684;&#x5904;&#x7406;&#x6D41;&#xFF0C;&#x7A0B;&#x5E8F;&#x5C31;&#x53EF;&#x4EE5;&#x91C7;&#x7528;&#x5B8C;&#x5168;&#x76F8;&#x540C;&#x7684;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x4EE3;&#x7801;&#x7C7B;&#x8BBF;&#x95EE;&#x4E0D;&#x540C;&#x7684;&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x968F;&#x7740;&#x5904;&#x7406;&#x6D41;&#x6240;&#x5305;&#x88C5;&#x7684;&#x8282;&#x70B9;&#x7684;&#x53D8;&#x5316;&#xFF0C;&#x7A0B;&#x5E8F;&#x5B9E;&#x9645;&#x6240;&#x8BBF;&#x95EE;&#x7684;&#x6570;&#x636E;&#x6E90;&#x4E5F;&#x76F8;&#x5E94;&#x5730;&#x53D1;&#x751F;&#x53D8;&#x5316;&#x3002;
FilterInputStream&#x3001;FilterOutputStream&#x3001;FilterReader&#x548C;FilterWriter&#x4EE5;&#x53CA;&#x5B83;&#x4EEC;&#x7684;&#x5B50;&#x7C7B;&#x662F;&#x5904;&#x7406;&#x6D41;&#x3002;
&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x901A;&#x8FC7;&#x88C5;&#x9970;&#x5668;&#x6A21;&#x5F0F;&#x6765;&#x4F7F;&#x7528;&#x5904;&#x7406;&#x6D41;&#x6765;&#x5305;&#x88C5;&#x8282;&#x70B9;&#x6D41;&#xFF0C;&#x901A;&#x8FC7;&#x5305;&#x88C5;&#x4E0D;&#x540C;&#x7684;&#x8282;&#x70B9;&#x6D41;&#xFF0C;&#x5373;&#x53EF;&#x4EE5;&#x6D88;&#x9664;&#x4E0D;&#x540C;&#x8282;&#x70B9;&#x6D41;&#x7684;&#x5B9E;&#x73B0;&#x5DEE;&#x5F02;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x63D0;&#x4F9B;&#x66F4;&#x65B9;&#x4FBF;&#x7684;&#x65B9;&#x6CD5;&#x6765;&#x5B8C;&#x6210;&#x8F93;&#x5165;/&#x8F93;&#x51FA;&#x529F;&#x80FD;&#xFF0C;&#x56E0;&#x6B64;&#x5904;&#x7406;&#x6D41;&#x4E5F;&#x79F0;&#x4E3A;&#x5305;&#x88C5;&#x6D41;&#x3002;</p>
<h4 id="&#x8282;&#x70B9;&#x6D41;">&#x8282;&#x70B9;&#x6D41;</h4>
<table>
<thead>
<tr>
<th style="text-align:center">&#x7C7B;&#x578B;</th>
<th style="text-align:center">&#x5B57;&#x7B26;&#x6D41;</th>
<th style="text-align:center">&#x5B57;&#x8282;&#x6D41;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">File</td>
<td style="text-align:center">FileReader&#x3001;FileWriter</td>
<td style="text-align:center">FileInputStream&#x3001;FileOutputStream</td>
</tr>
<tr>
<td style="text-align:center">Memory Array</td>
<td style="text-align:center">CharArrayReader&#x3001;CharArrayWriter</td>
<td style="text-align:center">ByteArrayInputStream&#x3001;ByteArrayOutputStream</td>
</tr>
<tr>
<td style="text-align:center">Memory String</td>
<td style="text-align:center">StringReader&#x3001;StringWriter</td>
<td style="text-align:center">StringBufferInputStream&#x3001;</td>
</tr>
<tr>
<td style="text-align:center">Pipe</td>
<td style="text-align:center">PipedReader&#x3001;PipedWriter</td>
<td style="text-align:center">PipedInputStream&#x3001;PipedOutputStream</td>
</tr>
</tbody>
</table>
<h4 id="&#x5904;&#x7406;&#x6D41;">&#x5904;&#x7406;&#x6D41;</h4>
<table>
<thead>
<tr>
<th style="text-align:center">&#x7C7B;&#x578B;</th>
<th style="text-align:center">&#x5B57;&#x7B26;&#x6D41;</th>
<th style="text-align:center">&#x5B57;&#x8282;&#x6D41;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">Buffer</td>
<td style="text-align:center">BufferedReader&#x3001;BufferedWriter</td>
<td style="text-align:center">BufferedInputStream&#x3001;BufferedOutputStream</td>
</tr>
<tr>
<td style="text-align:center">Filter</td>
<td style="text-align:center">FilterReader&#x3001;FilterWriter</td>
<td style="text-align:center">FilterInputStream&#x3001;FilterOutputStream</td>
</tr>
<tr>
<td style="text-align:center">Converter</td>
<td style="text-align:center">InputStreamReader&#x3001;OutputStreamWriter</td>
<td style="text-align:center"></td>
</tr>
<tr>
<td style="text-align:center">Object Serialization</td>
<td style="text-align:center"></td>
<td style="text-align:center">ObjectInputStream&#x3001;ObjectOutputStream</td>
</tr>
<tr>
<td style="text-align:center">DataConversion</td>
<td style="text-align:center"></td>
<td style="text-align:center">DataInputStream&#x3001;DataOutputStream</td>
</tr>
<tr>
<td style="text-align:center">Counting</td>
<td style="text-align:center">LineNumberReader</td>
<td style="text-align:center">LineNumberInputStream</td>
</tr>
<tr>
<td style="text-align:center">Peeking Ahead</td>
<td style="text-align:center">PushbackReader</td>
<td style="text-align:center">PushbackInputStream</td>
</tr>
<tr>
<td style="text-align:center">Printing</td>
<td style="text-align:center">PrintWriter</td>
<td style="text-align:center">PrintStream</td>
</tr>
</tbody>
</table>
<ul>
<li>Buffering&#x7F13;&#x51B2;&#x6D41;&#xFF1A;&#x5728;&#x8BFB;&#x5165;&#x6216;&#x5199;&#x51FA;&#x65F6;&#xFF0C;&#x5BF9;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x7F13;&#x5B58;&#xFF0C;&#x4EE5;&#x51CF;&#x5C11;I/O&#x7684;&#x6B21;&#x6570;&#xFF1A;BufferedReader&#x4E0E;BufferedWriter&#x3001;BufferedInputStream&#x4E0E;BufferedOutputStream&#x3002;</li>
<li>Filtering &#x6EE4;&#x6D41;&#xFF1A;&#x5728;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x8BFB;&#x6216;&#x5199;&#x65F6;&#x8FDB;&#x884C;&#x8FC7;&#x6EE4;&#xFF1A;FilterReader&#x4E0E;FilterWriter&#x3001;FilterInputStream&#x4E0E;FilterOutputStream&#x3002;</li>
<li>Converting between Bytes and Characters &#x8F6C;&#x6362;&#x6D41;&#xFF1A;&#x6309;&#x7167;&#x4E00;&#x5B9A;&#x7684;&#x7F16;&#x7801;/&#x89E3;&#x7801;&#x6807;&#x51C6;&#x5C06;&#x5B57;&#x8282;&#x6D41;&#x8F6C;&#x6362;&#x4E3A;&#x5B57;&#x7B26;&#x6D41;&#xFF0C;&#x6216;&#x8FDB;&#x884C;&#x53CD;&#x5411;&#x8F6C;&#x6362;&#xFF08;Stream&#x5230;Reader&#xFF09;&#xFF1A;InputStreamReader&#x3001;OutputStreamWriter&#x3002;</li>
<li>Object Serialization &#x5BF9;&#x8C61;&#x6D41;&#xFF1A;ObjectInputStream&#x3001;ObjectOutputStream&#x3002;</li>
<li>DataConversion&#x6570;&#x636E;&#x6D41;&#xFF1A;&#x6309;&#x57FA;&#x672C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x8BFB;&#x3001;&#x5199;&#xFF08;&#x5904;&#x7406;&#x7684;&#x6570;&#x636E;&#x662F;Java&#x7684;&#x57FA;&#x672C;&#x7C7B;&#x578B;&#xFF08;&#x5982;&#x5E03;&#x5C14;&#x578B;&#xFF0C;&#x5B57;&#x8282;&#xFF0C;&#x6574;&#x6570;&#x548C;&#x6D6E;&#x70B9;&#x6570;&#xFF09;&#xFF09;&#xFF1A;DataInputStream&#x3001;DataOutputStream &#x3002;</li>
<li>Counting&#x8BA1;&#x6570;&#x6D41;&#xFF1A;&#x5728;&#x8BFB;&#x5165;&#x6570;&#x636E;&#x65F6;&#x5BF9;&#x884C;&#x8BB0;&#x6570; &#xFF1A;LineNumberReader&#x3001;LineNumberInputStream&#x3002;</li>
<li>Peeking Ahead&#x9884;&#x8BFB;&#x6D41;&#xFF1A;&#x901A;&#x8FC7;&#x7F13;&#x5B58;&#x673A;&#x5236;&#xFF0C;&#x8FDB;&#x884C;&#x9884;&#x8BFB;&#xFF1A;PushbackReader&#x3001;PushbackInputStream&#x3002;</li>
<li>Printing&#x6253;&#x5370;&#x6D41;&#xFF1A;&#x5305;&#x542B;&#x65B9;&#x4FBF;&#x7684;&#x6253;&#x5370;&#x65B9;&#x6CD5;&#xFF1A;PrintWriter&#x3001;PrintStream&#x3002; </li>
</ul>
<h4 id="&#x7F13;&#x51B2;&#x6D41;">&#x7F13;&#x51B2;&#x6D41;</h4>
<p>&#x5BF9;I/O&#x8FDB;&#x884C;&#x7F13;&#x51B2;&#x662F;&#x4E00;&#x79CD;&#x5E38;&#x89C1;&#x7684;&#x6027;&#x80FD;&#x4F18;&#x5316;&#xFF0C;&#x7F13;&#x51B2;&#x6D41;&#x4E3A;I/O&#x6D41;&#x589E;&#x52A0;&#x4E86;&#x5185;&#x5B58;&#x7F13;&#x51B2;&#x533A;&#xFF0C;&#x589E;&#x52A0;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x4E24;&#x4E2A;&#x76EE;&#x7684;&#xFF1A; </p>
<ul>
<li>&#x5141;&#x8BB8;Java&#x7684;I/O&#x4E00;&#x6B21;&#x4E0D;&#x53EA;&#x64CD;&#x4F5C;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#xFF0C;&#x8FD9;&#x6837;&#x63D0;&#x9AD8;&#x41D6;&#x6574;&#x4E2A;&#x7CFB;&#x7EDF;&#x7684;&#x6027;&#x80FD;</li>
<li>&#x7531;&#x4E8E;&#x6709;&#x7F13;&#x51B2;&#x533A;&#xFF0C;&#x4F7F;&#x5F97;&#x5728;&#x6D41;&#x4E0A;&#x6267;&#x884C;skip&#x3001;mark&#x548C;reset&#x65B9;&#x6CD5;&#x90FD;&#x6210;&#x4E3A;&#x53EF;&#x80FD;&#x3002;</li>
</ul>
<p>&#x7F13;&#x51B2;&#x6D41;&#xFF1A;&#x5B83;&#x662F;&#x8981;&#x201C;&#x5957;&#x63A5;&#x201D;&#x5728;&#x76F8;&#x5E94;&#x7684;&#x8282;&#x70B9;&#x6D41;&#x4E4B;&#x4E0A;&#xFF0C;&#x5BF9;&#x8BFB;&#x5199;&#x7684;&#x6570;&#x636E;&#x63D0;&#x4F9B;&#x4E86;&#x7F13;&#x51B2;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x63D0;&#x9AD8;&#x4E86;&#x8BFB;&#x5199;&#x7684;&#x6548;&#x7387;&#xFF0C;&#x540C;&#x65F6;&#x589E;&#x52A0;&#x4E86;&#x4E00;&#x4E9B;&#x65B0;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x4F8B;&#x5982;&#xFF1A;BufferedReader&#x4E2D;&#x7684;readLine&#x65B9;&#x6CD5;&#xFF0C;BufferedWriter&#x4E2D;&#x7684;newLine&#x65B9;&#x6CD5;&#x3002;
&#x7F13;&#x51B2;&#x8F93;&#x5165;&#x6D41;BufferedInputSTream&#x9664;&#x4E86;&#x652F;&#x6301;read&#x548C;skip&#x65B9;&#x6CD5;&#x610F;&#x5916;&#xFF0C;&#x8FD8;&#x652F;&#x6301;&#x5176;&#x7236;&#x7C7B;&#x7684;mark&#x548C;reset&#x65B9;&#x6CD5;;
BufferedReader&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x65B0;&#x7684;ReadLine&#x65B9;&#x6CD5;&#x7528;&#x4E8E;&#x8BFB;&#x53D6;&#x4E00;&#x884C;&#x5B57;&#x7B26;&#x4E32;&#xFF08;&#x4EE5;\r&#x6216;\n&#x5206;&#x9694;&#xFF09;;
BufferedWriter&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x79CD;&#x65B0;&#x7684;newLine&#x65B9;&#x6CD5;&#x7528;&#x4E8E;&#x5199;&#x5165;&#x4E00;&#x4E2A;&#x884C;&#x5206;&#x9694;&#x7B26;;
&#x5BF9;&#x4E8E;&#x8F93;&#x51FA;&#x7684;&#x7F13;&#x51B2;&#x6D41;&#xFF0C;BufferedWriter&#x548C;BufferedOutputStream&#xFF0C;&#x5199;&#x51FA;&#x7684;&#x6570;&#x636E;&#x4F1A;&#x5148;&#x5728;&#x5185;&#x5B58;&#x4E2D;&#x7F13;&#x5B58;&#xFF0C;&#x4F7F;&#x7528; flush &#x65B9;&#x6CD5;&#x5C06;&#x4F1A;&#x4F7F;&#x5185;&#x5B58;&#x7684;&#x6570;&#x636E;&#x7ACB;&#x523B;&#x5199;&#x51FA;&#x3002;</p>
<!-- 
@startuml
Title "继承关系图"

字节流 -> InputStream
字节流 -> OutputStream

abstract class OutputStream
class FileOutputStream
class FilterOutputStream
class ObjectOutputStream
class PipedOutputStream
class ByteArrayOutputStream

class BufferedOutputStream
class DataOutputStream
class PrintStream

OutputStream <|-- FileOutputStream
OutputStream <|-- FilterOutputStream
OutputStream <|-- ObjectOutputStream
OutputStream <|-- PipedOutputStream
OutputStream <|-- ByteArrayOutputStream

FilterOutputStream <|-- BufferedOutputStream
FilterOutputStream <|-- DataOutputStream
FilterOutputStream <|-- PrintStream


abstract class InputStream
class FileInputStream
class FilterInputStream
class ObjectInputStream
class PipedInputStream
class SequenceInputStream
class StringBufferInputStream
class ByteArrayInputStream

class BufferedInputStream
class DataInputStream
class PushbackInputStream

InputStream <|-- FileInputStream
InputStream <|-- FilterInputStream
InputStream <|-- ObjectInputStream
InputStream <|-- PipedInputStream
InputStream <|-- SequenceInputStream
InputStream <|-- StringBufferInputStream
InputStream <|-- ByteArrayInputStream

FilterInputStream <|-- BufferedInputStream
FilterInputStream <|-- DataInputStream
FilterInputStream <|-- PushbackInputStream
@enduml

-->
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="java-basic-reflect.html" class="navigation navigation-prev " aria-label="Previous page: Java 基础 -- 反射">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="java-basic-final.html" class="navigation navigation-next " aria-label="Next page: Java 基础 -- 深入理解 final 修饰符">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Java IO -- IO流的概念和分类","categories":"Java","comments":true,"tags":["Java"],"description":"介绍IO流的概念和分类","date":"2014-04-12T10:00:00.000Z","level":"1.1.9","depth":2,"next":{"title":"Java 基础 -- 深入理解 final 修饰符","level":"1.1.10","depth":2,"path":"source/Java/java-basic-final.md","ref":"source/Java/java-basic-final.md","articles":[]},"previous":{"title":"Java 基础 -- 反射","level":"1.1.8","depth":2,"path":"source/Java/java-basic-reflect.md","ref":"source/Java/java-basic-reflect.md","articles":[]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"expandable-chapters":{},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"寒江蓑笠的博客","gitbook":"*"},"file":{"path":"source/Java/java-basic-io-stream.md","mtime":"2022-05-17T10:49:59.384Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-05-17T10:54:58.084Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

